<template>
	<view>
		<view class="centent" v-for="(item,index) in teacherList" :key="index">
			<view class="">
				<text>{{item.nickname}}</text>
				<text>【</text>
				<text>{{item.zhiwei}}</text>
				<text>】</text>
				<text>{{item.phone}}</text>
				<text v-if="item.bzr==1">班主任</text>
			</view>
			<view class="" @tap="getphone(item.phone)">
				<text>拨打电话</text>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {
		mapState,
		mapGetters,
		mapMutation,
		mapActions
	} from 'vuex';
	export default {
		computed: {
			...mapState({
				userInfo: state => state.user.userInfo,
				// parentId: state => state.user.parentId,
				isLogin: state => state.user.isLogin
			})
		},
		data() {
			return {
				teacherList:[],
				class_id:0
			}
		},
		methods: {
			getphone(phone){
				uni.makePhoneCall({
				    phoneNumber: phone //仅为示例
				});
			},
			showteacherList(){
				this.$store
					.dispatch('showteacherList', {
						token: this.userInfo.token,
						class_id: this.class_id				
					})
					.then(res => {
						console.log(res)
						this.teacherList = res.data.data
						console.log(this.teacherList)
					});
			}
			
		},
		onLoad(data) {
			this.class_id = data.class_id
			console.log(this.class_id)
			this.showteacherList()
		}
	}
</script>

<style lang="less">
.centent{
	padding: 20rpx;
	display: flex;
	justify-content: space-between;
	background-color: #0086B3;
	margin-bottom: 10rpx;
	
}
</style>
